﻿using System;
using NiuX.Dapper.Abstractions;
using NiuX.Dapper.Quotes;
using NiuX.Dapper.Repositories;
using NiuX.Dapper.Visitors;

namespace NiuX.Dapper.Querables;

public class ExpressionVisitorFactory
{
    public IDataProviderFactory DataProviderFactory { get; set; }

    public SelectExpressionVisitor<T> GetSelectExpressionVisitor<T>()
    {

        return new SelectExpressionVisitor<T>()
        {
            SqlQuote = GetSqlQuote()
        };
    }

    public SelectExpressionVisitor<T, TResult> GetSelectExpressionVisitor<T, TResult>()
    {
        return new SelectExpressionVisitor<T, TResult>()
        {
            SqlQuote = GetSqlQuote()

        };
    }

    public WhereVisitor GetWhereVisitor()
    {
        return new WhereVisitor()
        {
            SqlQuote = GetSqlQuote()
        };
    }

    private ISqlQuote GetSqlQuote() => DataProviderFactory.GetSqlQuote();

}